﻿@model AutoPartsSearch.Domain.Entities.SellerSearchQuery
@{
    ViewBag.Title = @T("Детали запроса").ToHtmlString();
}
<h2 class="title">@T("Детали запроса")</h2>
<div class="container-main ui-corner-all padtop5">
    @using (Html.BeginForm())
    {
        <div id="errors" title="@T("Пожалуйста, исправьте ошибки и попробуйте еще раз.")" style="display: none;">
            @Html.ValidationSummary(false)
        </div>
        <fieldset>
            <div class="container-sub">
                <div class="container-header hght18px mrgbot3">
                </div>
                <fieldset class="fieldset-visible">
                    <legend>@T("Запчасть") </legend>
                    <table id="step1" class="table-form">
                        <tbody>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.PartName)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.PartName)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.PartGroup)
                                </td>
                                <td>
                                    @Html.DisplayFor(x => x.SearchQuery.PartGroup)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.PartCatalogNumber)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.PartCatalogNumber)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.PartType)
                                </td>
                                <td>
                                    @Html.DisplayFor(x => x.SearchQuery.PartType)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.PartState)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.PartState)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.PartDescription)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.PartDescription)
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
                <fieldset class="fieldset-visible">
                    <legend>@T("Автомобиль") </legend>
                    <table id="step2" class="table-form">
                        <tbody>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarType)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarType)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarYear)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarYear, "YearDropDown")
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarBrand)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarBrand)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarModel)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarModel)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarModification)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarModification)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarVin)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarVin)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarEngine)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarEngine)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarCase)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarCase)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarTransmission)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarTransmission)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarDrive)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarDrive)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.CarFuelType)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.CarFuelType)
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
                <fieldset class="fieldset-visible">
                    <legend>@T("Контактные данные покупателя") </legend>
                    <table id="step3" class="table-form">
                        <tbody>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.City)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.City)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.Name)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.Name)
                                </td>
                            </tr>
                            @* <tr>
                            <td>
                                @Html.LabelFor(model => model.SearchQuery.Phone)
                            </td>
                            <td>
                                @Html.DisplayFor(model => model.SearchQuery.Phone)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                @Html.LabelFor(model => model.SearchQuery.Phone2)
                            </td>
                            <td>
                                @Html.DisplayFor(model => model.SearchQuery.Phone2)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                @Html.LabelFor(model => model.SearchQuery.Email)
                            </td>
                            <td>
                                @Html.DisplayFor(model => model.SearchQuery.Email)
                            </td>
                        </tr>*@
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.SearchQuery.Comment)
                                </td>
                                <td>
                                    @Html.DisplayFor(model => model.SearchQuery.Comment)
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
            </div>
            <div class="container-sub mrgtop3 hght31px">
                @using (Html.BeginForm("Delete", "SellerSearchQuery", new { id = Model.SearchQuery.Id }, FormMethod.Post))
                {
                    @Html.ActionLink(@T("Удалить").ToHtmlString(), "Delete", null, new { @class = "button fr mrgleft5 delete dependable" })
                }
                
                @Html.ActionLink(@T("Сделать предложение").ToHtmlString(), "SendOffer", "Offer", new { id = Model.SearchQuery.Id }, new { @class = "button fr mrgleft5 wid150px dependable" })
                @Html.ActionLink(@T("<< Назад к списку").ToHtmlString(), "List", new { }, new { @class = "button fr mrgleft5 wid150px" })
            </div>
        </fieldset>
    }
</div>

@section Scripts
{
    <script type="text/javascript">
        $(document).ready(function () {
            var isBlocked = @ViewBag.IsSellerBlocked ;
            if (isBlocked) {
                $(".dependable").click(function (e) {
                    e.preventDefault();
                });
                $(".dependable").addClass("bg-grey");
            }

            $(".delete").not(".bg-grey").click(function () {
                if (confirm('@T("Вы действительно хотите удалить этот запрос из списка?")')) {
                    $(this).closest("form").submit();
                } 
                return false;
            });
        });
    </script>
}
